home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / grafik / raytracing / rayshade-4.0.6.3 / fixes / fix013 < prev    next >
Text File  |  1994-08-09  |  4KB  |  111 lines

  1. From theseas!nfotis Sat, 10 Jul 93 01:37:32 EET
  2. Received: by kriton.UUCP (V1.16/Amiga)
  3.     id AA00000; Sat, 10 Jul 93 01:37:32 EET
  4. Received: by theseas.ntua.gr; Fri, 9 Jul 93 21:50:54 +0300
  5. Received: by icaros.ntua.gr ; Fri, 9 Jul 93 21:49:20 +0300
  6. Message-Id: <9307091849.AA06850@icaros.ntua.gr>
  7. Date: Fri, 9 Jul 1993 21:49:19 +0300 (EET DST)
  8. X-Mailer: ELM [version 2.4 PL21]
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=US-ASCII
  11. Content-Transfer-Encoding: 7bit
  12. Content-Length: 3594
  13. From: Nick C. Fotis <theseas.ntua.gr!nfotis>
  14. To: theseas!kyrimis (Kr. Kyrimis)
  15. Subject: Re:  hf's inside csg's problem (fwd)
  16.  
  17. Forwarded message:
  18.  From halt@dsd.es.com Fri Jul  9 01:42:06 1993
  19. Errors-To: core-owner%itchy@dsd.es.com
  20. Errors-To: core-owner%itchy@dsd.es.com
  21. Date: Thu, 8 Jul 93 13:05:19 -0700
  22. Message-Id: <9307082005.AA14560@itchy>
  23. Errors-To: core-owner%itchy@dsd.es.com
  24. Reply-To: core@dsd.es.com (TraceCore Mailing List)
  25. From: Craig Kolb <cek@princeton.edu>
  26. Subject: Re:  hf's inside csg's problem
  27. List-Name: tracecore
  28. Precedence: Bulk
  29. Apparently-To: nfotis@theseas.ntua.gr
  30.  
  31. > I've been trying to figure out the problem that was brought up
  32. > about using heightfields in CSG objects.
  33. > [...]
  34. > What appears to be happening
  35. > is that mindist is being passed in as 2.09878, the call to OutOfBounds()
  36. > fails and hitpos is being set back equal to ray->pos resulting in hitpos.y
  37. > being negative [...]
  38.  
  39. This is a bug in 4.0.6 -- see the attached bugfix.  In short, the
  40. entire "else" clause in the HF bbox test is bogus.  Nuke it.
  41.  
  42. >A few questions --  What is the actual purpose of mindist?  I was
  43. >under the impression that it was a "fudge" factor to keep rays being fired
  44. >off an object from hitting that object again (due to round off errors).  With
  45. >CSG objects, is mindist supposed to help narrow the range being searched
  46. >(i.e. only look for the objects between mindist and maxdist rather than
  47. >from 0 (or EPSILON) to maxdist (since there is something closer at mindist??)).
  48.  
  49. Yup, exactly.  The intersection routines are supposed to return the
  50. closest intersection betwheen "mindist" and "maxdist" along the ray
  51.  
  52. Craig
  53.  
  54. ---
  55.  
  56. I've discovered a bug in rayshade's heightfield rendering code.
  57. This bug could cause rayshade to dump core, especially when
  58. rendering transparent height fields or heightfields that
  59. cast "long" shadows.
  60.  
  61. The fix will appear in the next release.  If you wish to fix
  62. the bug before then, edit libray/libobj/hf.c.  Lines 202-214 read:
  63.  
  64.         /*
  65.          * Find where we hit the hf cube.
  66.          */
  67.         VecAddScaled(ray->pos, mindist, ray->dir, &hitpos);
  68.         if (OutOfBounds(&hitpos, hf->boundbox)) {
  69.                 offset = *maxdist;
  70.                 if (!BoundsIntersect(ray, hf->boundbox, mindist, &offset))
  71.                         return FALSE;
  72.                 hitpos.x = ray->pos.x + ray->dir.x * offset;
  73.                 hitpos.y = ray->pos.y + ray->dir.y * offset;
  74.                 hitpos.z = ray->pos.z + ray->dir.z * offset;
  75.         } else
  76.                 hitpos = ray->pos;
  77.  
  78.  
  79. To fix the bug, remove the "else" case entirely, to make the
  80. block of code read:
  81.  
  82.  
  83.         /*
  84.          * Find where we hit the hf cube.
  85.          */
  86.         VecAddScaled(ray->pos, mindist, ray->dir, &hitpos);
  87.         if (OutOfBounds(&hitpos, hf->boundbox)) {
  88.                 offset = *maxdist;
  89.                 if (!BoundsIntersect(ray, hf->boundbox, mindist, &offset))
  90.                         return FALSE;
  91.                 hitpos.x = ray->pos.x + ray->dir.x * offset;
  92.                 hitpos.y = ray->pos.y + ray->dir.y * offset;
  93.                 hitpos.z = ray->pos.z + ray->dir.z * offset;
  94.         }
  95.  
  96.  
  97. Run "make", making sure that rayshade (and raypaint, if appropriate)
  98. are re-linked, and you should be all set.
  99.  
  100.  
  101. -- 
  102. Nick (Nikolaos) Fotis         National Technical Univ. of Athens, Greece
  103. HOME: 16 Esperidon St.,       InterNet : nfotis@theseas.ntua.gr
  104.       Halandri, GR - 152 32   UUCP:    mcsun!pythia!theseas!nfotis
  105.       Athens, GREECE          FAX: (+30 1) 77 84 578
  106.  
  107. USENET Editor of comp.graphics Resource Listing and soc.culture.greece FAQ
  108. NTUA/UA ACM Student Chapter Chair - we're organizing a small conference
  109.         in Comp. Graphics, call if you're interested to participate.
  110.  
  111.